﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WmsApp.WmsService;

namespace WmsApp.StaticData
{
    public class StaticObjects
    {
        public static void RefreshStaticObjects()
        {
            _goodsCodeTypes = Factory.WmsServiceFactory.GetServiceClient().GetGoodsCodeTypes();
            _specificationTypes = Factory.WmsServiceFactory.GetServiceClient().GetSpecificationTypeList();
            _specificationTypeItems = Factory.WmsServiceFactory.GetServiceClient().GetSpecificationTypeItemList();
            _customers = Factory.WmsServiceFactory.GetServiceClient().GetCustomers();
            _inStoreTypes = Factory.WmsServiceFactory.GetServiceClient().GetInStoreTypes();
            _outStoreTypes = Factory.WmsServiceFactory.GetServiceClient().GetOutStoreTypes();
        }


        private static List<GoodsCodeType> _goodsCodeTypes = null;
        public static List<GoodsCodeType> GetGoodsCodeTypes()
        {
            return _goodsCodeTypes ??
                   (_goodsCodeTypes = Factory.WmsServiceFactory.GetServiceClient().GetGoodsCodeTypes());
        }

        private static List<string> _specificationTypes = null;
        public static List<string> GetSpecificationTypes()
        {
            return _specificationTypes ??
                   (_specificationTypes = Factory.WmsServiceFactory.GetServiceClient().GetSpecificationTypeList());
        }

        private static List<SpecificationTypeItem> _specificationTypeItems = null;
        public static List<SpecificationTypeItem> GetSpecificationTypeItems()
        {
            return _specificationTypeItems ??
                   (_specificationTypeItems =
                   Factory.WmsServiceFactory.GetServiceClient().GetSpecificationTypeItemList());
        }

        private static List<Customer> _customers = null;
        public static List<Customer> GetCustomers()
        {
            return _customers ?? (_customers = Factory.WmsServiceFactory.GetServiceClient().GetCustomers());
        }

        private static List<InStoreType> _inStoreTypes = null;
        public static List<InStoreType> GetInStoreTypes()
        {
            return _inStoreTypes ?? (_inStoreTypes = Factory.WmsServiceFactory.GetServiceClient().GetInStoreTypes());
        }

        private static List<OutStoreType> _outStoreTypes = null;
        public static List<OutStoreType> GetOutStoreTypes()
        {
            return _outStoreTypes ?? (_outStoreTypes = Factory.WmsServiceFactory.GetServiceClient().GetOutStoreTypes());
        }
    }
}
